2.5.10.1.3 Boolean

In Solidity, bool stands for a Boolean value that is either true or false.

Booleans are pretty useful in the functions where we write the

business logic and compare the different values with the help of

logical operations like “or”, “and”, “equal to”, “not equal to”, “greater

than”, “smaller than” etc., to get a Boolean value.

2.5.10.1.4 Byte

Byte is a fixed size array of value type. It comes with a special

functionality called “.length” that returns the length of the byte array.

Please note that a byte can be a dynamically sized byte or string as

well; however, that would fall under the value by reference as the

size might grow bigger than the maximum size for the pass by value

type of variables.

2.5.10.1.5 String Literals

A string can be represented by any group of characters within the

double or single apostrophes, i.e., “” or ‘’. Unlike byte, the string does

not come with special functionality called “.length”. Hence,

depending upon the requirement, a byte or string has to be chosen

by the programmer as a byte can also work as an array of characters

which is ultimately similar to a string. If required, bytes can be

converted to a string as well. Refer to the following code:

// SPDX-License-Identifier: Some Identifier

pragma solidity ^0.8.10;

contract BytesToStringContract {

function bytesToString() public pure returns(string memory)

{

bytes memory byteString = “Sample data”;

string memory message = string(byteString);

return message;

}

}